/**
 * There are <a href="https://github.com/thinkgem/jeesite">JeeSite</a> code generation
 */
package com.boxin.ims.modules.jiujiudevice.service;

import org.apache.commons.lang3.StringUtils;
import org.hibernate.criterion.DetachedCriteria;
import org.hibernate.criterion.Order;
import org.hibernate.criterion.Restrictions;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;

import com.thinkgem.jeesite.common.persistence.Page;
import com.thinkgem.jeesite.common.service.BaseService;
import com.thinkgem.jeesite.common.utils.JedisUtils;
import com.boxin.ims.modules.jiujiudevice.entity.JiuCashConfig;
import com.boxin.ims.modules.jiujiudevice.entity.JiuFreeTime;
import com.boxin.ims.modules.jiujiudevice.dao.JiuFreeTimeDao;

/**
 * 设备免费配置Service
 * @author sxh
 * @version 2018-11-24
 */
@Component
@Transactional(readOnly = true)
public class JiuFreeTimeService extends BaseService {

	@SuppressWarnings("unused")
	private static Logger logger = LoggerFactory.getLogger(JiuFreeTimeService.class);
	
	@Autowired
	private JiuFreeTimeDao jiuFreeTimeDao;
	
	public JiuFreeTime get(Long id) {
		return jiuFreeTimeDao.findOne(id);
	}
	public Page<JiuFreeTime> find(Page<JiuFreeTime> page, JiuFreeTime jiuFreeTime) {
		DetachedCriteria dc = jiuFreeTimeDao.createDetachedCriteria();
		dc.addOrder(Order.desc("id"));
		return jiuFreeTimeDao.find(page, dc);
	}
	
	@Transactional(readOnly = false)
	public void save(JiuFreeTime jiuFreeTime) {
		jiuFreeTimeDao.save(jiuFreeTime);
	}
	
	@Transactional(readOnly = false)
	public void delete(Long id) {
		jiuFreeTimeDao.deleteById(id);
	}
	
}
